- /* slmlsadd.cpp by K.Tsuru */
- // function ID = 232 DRADIX, BRADIX
- /*******************************************************************
- SLong, SIntefer class
- It adds a small positive value to the abusolute value implemented
- for radix conversion.
- *******************************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- void SLong::LsAdd(fType a){
- if(!a) return;
- fType rdx = Radix();
- int norm = 0; //It is necessary to normalize or not.
- if(Sign(232) == 0) SetSign(1); //It also checks the allocation of memory.
- if(a <= BRADIX){ // figure[0] + a < fTypeMax = USHRT_MAX
- figure[0] += a;
- if(figure(0) >= rdx) norm = 1;
- } else{
- ulong u = (ulong)figure(0) + (ulong)a;
-
- figure[0] = fType(u%rdx);
- figure[1] += fType(u/rdx);
- if(figure(1) >= rdx) norm = 1;
- if(!aHead) aHead = 1u; //The figure increases to two from one.
- }
- aTail = 0;
- while(!figure(aTail)) aTail++;
-
- if(norm) Normalize(); //normalization
- }
slmlsadd.cpp : last modifiled at 2017/03/13 14:32:01(983 bytes)
created at 2017/10/07 10:26:49
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).